package com.ittony.blog.mapper;

import com.ittony.blog.entity.Article;
import com.ittony.blog.entity.ArticleTagRef;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.HashMap;
import java.util.List;

@Mapper
public interface ArticleMapper {

    Integer deleteById(Integer articleId);

    Integer deleteByUserId(Integer userId);

    Integer insert(Article article);

    Integer update(Article article);

    List<Article> findAll(HashMap<String, Object> criteria);

    List<Article> listAllNotWithContent();

    Integer countArticle(@Param(value = "status") Integer status);

    Integer countArticleComment();

    Integer countArticleView();

    List<Article> listArticle();

    Article getArticleByStatusAndId(@Param(value = "status") Integer status, @Param(value = "id") Integer id);

    @Deprecated
    List<Article> pageArticle(@Param(value = "status") Integer status,@Param(value = "pageIndex") Integer pageIndex,@Param(value = "pageSize") Integer pageSize);

    List<Article> listArticleByViewCount(@Param(value = "limit") Integer limit);

    Article getAfterArticle(@Param(value = "id") Integer id);

    Article getPreArticle(@Param(value = "id") Integer id);

    List<Article> listRandomArticle(@Param(value = "limit") Integer limit);

    List<Article> listArticleByCommentCount(@Param(value = "limit") Integer limit);

    void updateCommentCount(@Param(value = "articleId") Integer articleId);

    Article getLastUpdateArticle();

    Integer countArticleByUser(@Param(value = "id") Integer id);

    List<Article> findArticleByCategoryId(@Param(value = "categoryId") Integer categoryId,@Param("limit") Integer limit);

    List<Article> findArticleByCategoryIds(@Param("categoryIds")List<Integer> categoryIds,@Param("limit") Integer limit);

    List<Article> listArticleByLimit(@Param("userId") Integer userId,@Param("limit") Integer limit);

    Integer deleteBatch(@Param("ids")List<Integer> ids);

    List<Integer> listArticleIdsByUserId(Integer userId);



}
